#include "MatrixLED.h"

sbit RCK = P3^5;
sbit SCK = P3^6;
sbit SER = P3^4;

void _74HC595_WriteByte(unsigned char byte) {
	int i;
	for(i = 0; i < 8; i++) {
	 	SER = byte & (0x80 >> i);
		SCK = 1;
		SCK = 0;
	}
	RCK = 1;
	RCK = 0;
}

void Delay200us()		//@12.000MHz
{
	unsigned char i;

	i = 97;
	while (--i);
}

void FlushMatrixLED(const unsigned char *bytes) {
	int i;
	for(i = 0; i < 8; i++) {
		P0 = 0xFF;
		_74HC595_WriteByte(bytes[i]);
		P0 = ~(0x80 >> i);
		Delay200us();
	}
}
